<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="me.linczh.bank.bean.AccountBean" %>
<%@ page import="me.linczh.bank.bean.enums.AccountType" %>
<%@ page import="me.linczh.bank.bean.enums.DepositType" %>
<%@ page import="me.linczh.bank.bean.enums.ResultType" %>

<p>
	<%=request.getAttribute("contentpage") %>
</p>
<% if (request.getAttribute("result") != null) {
			ResultType result = (ResultType)request.getAttribute("result");
			if (result != ResultType.SUCCESS) {
 %>
<div class="alert alert-danger">
  <strong>操作失败</strong><br> <%=ResultType.parse(result) %> <a href="viewpage.action?page=account/create" class="alert-link">重新填写</a>
</div>
<% 		} else { 
				AccountBean abean = (AccountBean)request.getAttribute("accountBean"); %>
<div class="alert alert-success">
  <strong>操作成功</strong><br> 创建了一个账户!
</div>
<div>
	<p>
	  <strong>账号</strong>&nbsp;<%=abean.getAccount() %>
	  <% switch (abean.getDeposittype()) {
	  		case CHECKING: %>
	  <span class="label label-primary">活期</span>
	  <%	break;
	  		default: %>
	  <span class="label label-success">定期</span>
	  <% } %>
	  <% switch (abean.getAccounttype()) {
	  		case PERSONAL_COMMON: %>
	  <span class="label label-info">个人普通账户</span>
	  <%	break;
	  		case PERSONAL_VIP: %>
	  <span class="label label-warning">个人VIP账户</span>
	  <%	break;
	  		default: %>
	  <span class="label label-danger">企业账户</span>
	  <% } %>
  </p>
  <p><strong>余额</strong>&nbsp;<%=abean.getBalance() %></p>
  <p><strong>开户时间</strong>&nbsp;<%=abean.getCreatetime() %></p>
</div>
<%		}
	 } else { %>
<form action="account.create.action" method="POST" role="form">
	<fieldset>
		<legend>客户信息</legend>
		<div class="form-group">
	    <label for="username">开户姓名</label>
	    <input type="text" class="form-control" id="username" name="username" placeholder="开户姓名">
	  </div>
		<div class="form-group">
	    <label for="identity">身份证号码</label>
	    <input type="text" class="form-control" id="identity" name="identity" placeholder="身份证号码">
	  </div>
	</fieldset>
	<fieldset>
		<legend>账户信息</legend>
	  <p>
	  <label class="radio-inline">
		  <input type="radio" name="accounttype" value="PERSONAL_COMMON"> 普通个人账户
		</label>
    <label class="radio-inline">
		  <input type="radio" name="accounttype" value="PERSONAL_VIP"> VIP个人账户
		</label>
		<label class="radio-inline">
		  <input type="radio" name="accounttype" value="ENTERPRISE"> 企业账户
		</label>
		</p>
		<div class="form-group">
	    <label for="balance">初始余额</label>
	    <input type="number" step="any" class="form-control" id="balance" name="balance" placeholder="初始余额">
	  </div>
	  <p>
	  <label class="radio-inline">
		  <input type="radio" name="deposittype" value="CHECKING"> 活期
		</label>
    <label class="radio-inline">
		  <input type="radio" name="deposittype" value="SAVING"> 定期
		</label>
		</p>
	  <div class="form-group">
	    <label for="password">账户密码</label>
	    <input type="password" class="form-control" id="password" name="password" placeholder="账户密码">
	  </div>
	</fieldset>
	<button type="submit" class="btn btn-default">开户</button>
</form>
<% } %>